'use strict'

class square {

  constructor () {
    //param默认就是/:id，若要改变路由，则可以设置此属性，比如设置为/:name
    //this.param = '/:id'
  }
  //获取列表
  async list (c) {
    let ret = await c.service.psql.query(`select * from square left join users on square.open_id=users.open_id where users.open_id is not null order by posts_time desc`);
    //等效于 c.res.body = ret.rows
    c.send(ret.rows)
  }

}

module.exports = square
